package com.wing.wcabinet.model.entity;

import java.io.Serializable;

import com.alibaba.cloud.commons.lang.StringUtils;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.wing.cabinet.model.entity.CheckedResultDetail;
import com.wing.cabinet.model.entity.StorageInventoryInout;
import com.wing.mybatis.common.BaseEntity;
import com.wing.platform.order.model.entity.Version;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 售刀柜上货(上货主表无展示)/领取
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("wcab_cell_inventory_inout")
public class WcabCellInventoryInout extends BaseEntity<WcabCellInventoryInout> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum InoutType implements IEnum<Integer> {

        /**
        * 上货
        */
        in(1,"上货"),
        /**
        * 领取
        */
        out(2,"领取");


        private int code;
        private String desc;

        InoutType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum IsBill implements IEnum<Integer> {

        /**
        * 未形成
        */
        no(0,"未形成"),
        /**
        * 已形成
        */
        yes(1,"已形成");

        private int code;
        private String desc;

        IsBill(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum BusinessType implements IEnum<Integer> {

        losed(0,"缺失"),
        normal(1,"可用"),
        /**
        * 维修
        */
        repair(2,"维修"),
        /**
        * 报废
        */
        recycle(3,"报废");

        private int code;
        private String desc;

        BusinessType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static BusinessType jsonCreator(String name) {
            if (org.apache.commons.lang.StringUtils.isNotBlank(name)) {
                for (BusinessType item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }


    public enum OperationType implements IEnum<Integer> {

        /**
         * 业务类型:cellCabReceive(1,售刀柜领取);repairOrderSign(2,维修订单签收)
         */
        load(1,"重力柜上货"),
        unload(2,"重力柜下货"),
        out(3,"重力柜领取"),



        outByReturned(4,"归还仓库管理员"),

        returnIn(5,"回库"),

        supplyIn(6,"补货"),
        /**
         * 维修
         */
        repairIn(7,"维修存入"),
        /**
         * 回收
         */
        recycleIn(8,"报废存入"),


        repairOutByCheck(9,"盘验维修取出"),

        recycleOutByCheck(10,"盘验报废取出"),


        normalInByCheck(11,"盘验可用存入"),

        normalOutByCheck(12,"盘验可用取出"),

        normalOutByCheckLose(14,"盘验可用缺失"),

        repairOutByCheckLose(15,"盘验维修缺失"),

        recycleOutByCheckLose(16,"盘验报废缺失"),


        normalOutByCheckSpec(17,"盘验可用产品规格不相符"),

        repairOutByCheckSpec(18,"盘验维修产品规格不相符"),

        recycleOutByCheckSpec(19,"盘验报废产品规格不相符"),

        importUseByExcel(20,"导入在用物料"),

        virtualOutByCheck(21,"维修报废盘验为暂存取出"),

        normalInVirtualByCheckQuantity(22,"盘验可用对冲存入数量"),

        normalOutVirtualByCheckQuantity(23,"盘验可用对冲取出数量"),

        normalInVirtualByCheckWeight(24,"盘验可用对冲存入重量"),

        normalOutVirtualByCheckWeight(25,"盘验可用对冲取出重量"),

        normalInVirtualByCheckWeightQuantity(24,"盘验可用对冲存入数量重量"),

        normalOutVirtualByCheckWeightQuantity(25,"盘验可用对冲取出数量重量");

        private int code;
        private String desc;

        OperationType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static OperationType jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (OperationType item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    public enum Status implements IEnum<Integer> {

        /**
         * 已创建/待盘验
         */
        created(0,"已创建/待盘验"),
        /**
         * 已盘验
         */
        checked(1,"已盘验"),
        /**
         * 已通知/回收中
         */
        notified(2,"已通知/回收中"),
        /**
         * 平台已取货/已回收
         */
        taked(3,"平台已取货/已回收"),
        /**
         * 已签收/已完成
         */
        signed(4,"已签收/已完成");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }



    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 存刀任务编号
     */
    private String code;

    /**
     * 配送单id
     */
    private Long deliveryId;

    /**
     * 操作类型
     */
    private InoutType inoutType;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String inoutTypeDesc;

    public String getInoutTypeDesc() {
        return inoutType == null ? null : inoutType.getDesc();
    }

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 设备台机
     */
    private String deviceCode;

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
    * 同步时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime synsTime;

    /**
     * 是否已形成账单
     */
    private IsBill isBill;

    /**
    * 是否已形成账单描述
    */
    @TableField(exist = false)
    private String isBillDesc;

    public String getIsBillDesc() {
        return isBill == null ? null : isBill.getDesc();
    }

    /**
     * 上货记录id
     */
    private Long receiveLoadId;

    /**
     * enterpriseId
     */
    private Long enterpriseId;

    /**
     * 工序id
     */
    private Long processId;

    /**
     * 计划id
     */
    private Long planId;

    /**
     * enterpriseCode
     */
    private String enterpriseCode;

    /**
     * 业务类型
     */
    private BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        return businessType == null ? null : businessType.getDesc();
    }


    private OperationType operationType;

    @TableField(exist = false)
    private String operationTypeDesc;

    public String getOperationTypeDesc(){
        if (operationType!=null){
            return operationType.getDesc();
        }
        return "";
    }

    private Long allocationId;


    /**
     * 状态
     */
    private Status status;

    /**
     * 状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 盘验时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime checkTime;

    /**
     * 盘验人id
     */
    private Long checkUserId;

    /**
     * 盘验人
     */
    private String checkUserName;

    /**
     * 通知时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime notifyTime;

    /**
     * 通知人
     */
    private Long notifyUserId;

    /**
     * 通知人
     */
    private String notifyUserName;

    /**
     * 回收人id
     */
    private Long takeUserId;

    /**
     * 回收人
     */
    private String takeUserName;

    /**
     * 回收时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime takeTime;

    /**
     * 盘验完操作类型
     */
    private Integer operationTypeChecked;


    /**
     * 签收人id
     */
    private String signUserId;

    /**
     * 签收时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime signTime;

    /**
     * 签收人
     */
    private String signUserName;

    /**
     * 盘验结果id
     */
    private Long checkedResultId;

    /**
     * 通知供应商id
     */
    private Long supplierId;

    /**
     * 通知供应商
     */
    private String supplierName;

    /**
     * 盘验：0：否，1：是
     */
    private Boolean isCheck;

    /**
     * supplierCompanyId
     */
    private Long supplierCompanyId;

    /**
     * 姓名
     */
    private String creatorNickname;

    public enum BusinessTypePre implements IEnum<Integer> {
        losed(0,"缺失"),
        /**
         * 暂存
         */
        normal(1,"可用"),
        /**
         * 维修
         */
        repair(2,"维修"),
        /**
         * 回收
         */
        recycle(3,"报废");

        private int code;
        private String desc;

        BusinessTypePre(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static BusinessTypePre jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (BusinessTypePre item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }


    /**
     * businessTypePre
     */
    private BusinessTypePre businessTypePre;

    /**
     * useInventoryInoutId
     */
    private Long useInventoryInoutId;

    /**
     * checkInventoryInoutId
     */
    private Long checkInventoryInoutId;

    /**
     * storageInventoryOutId
     */
    private Long storageInventoryOutId;

    /**
     * workOrderId
     */
    private Long workOrderId;

    /**
     * departmentId
     */
    private Long departmentId;

    /**
     * departmentName
     */
    private String departmentName;


    public enum BusinessTypeChecked implements IEnum<Integer> {
        losed(0,"缺失"),
        /**
         * 暂存
         */
        normal(1,"暂存"),
        /**
         * 维修
         */
        repair(2,"维修"),
        /**
         * 回收
         */
        recycle(3,"报废");

        private int code;
        private String desc;

        BusinessTypeChecked(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }

        @JsonCreator
        public static BusinessTypeChecked jsonCreator(String name) {
            if (StringUtils.isNotBlank(name)) {
                for (BusinessTypeChecked item : values()) {
                    if (item.name().equals(name.trim())) {
                        return item;
                    }
                }
            }
            return null;
        }
    }

    private BusinessTypeChecked businessTypeChecked;


    private String roleName;


    private String orderCode;
    /**
     * 渠道编号
     */
    private String channelCode;
}
